Skip to content

README pdf-to-jpg snippet without ScaleImage/ScaleProportions; split example links pdf-to-split - #57

Merged
tomasr78 merged 1 commit into
mainfrom
fix-pdf-to-jpg-params
Nov 9, 2026
Merged

tomasr78 merged 1 commit into
mainfrom
fix-pdf-to-jpg-params

Conversation

@tomasr78

@tomasr78 tomasr78 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • The README "Additional conversion parameters" snippet passed scaleimage and scaleproportions to pdf -> jpg. Neither is a pdf-to-jpg parameter (spec), and the API ignores them silently, so readers copy two parameters that do nothing. They exist only on jpg-to-jpg (spec).
  • The comment in SplitAndMergePdf.java linked https://www.convertapi.com/pdf-to-extract (now the AI data-extraction converter), although the example uses split.

Change

  • README snippet: page 1 of test.pdf becomes a JPG that fits inside 300x300, with pagerange 1, imagewidth 300, imageheight 300 and fittosize "true". Without fittosize, pdf-to-jpg applies the width and lets the height grow (300x388 for a US Letter page). Param has no boolean constructor, so fittosize is a string, as scaleimage was.
  • SplitAndMergePdf.java links https://www.convertapi.com/pdf-to-split ("Split PDF API", checked in a browser on 2026-11-09).

Verification

OpenJDK 27.0.1 with convertapi 2.13.1 from Maven Central (./mvnw -f examples/pom.xml compile), against the production API on 2026-11-09. $TMPDIR stands for a local scratch folder.

The README snippet, pasted verbatim into a main that sets the token, then prints the cost and saves result, run in a folder holding test.pdf (a copy of examples/src/main/resources/test.pdf):

conversion cost: 1, files: 1
saved: $TMPDIR/readme-snippet.jpg

readme-snippet.jpg is 231x300 px, 8,858 bytes.

SplitAndMergePdf (only its comment changed), run in a folder holding files/test.pdf:

$ java com.convertapi.examples.SplitAndMergePdf
Creating PDF with the first and the last pages
PDF file saved to: $TMPDIR/test-1-1.pdf

qpdf --show-npages: the merged PDF has 2 pages, test.pdf has 6.

Only the README and an example comment change, not the library, so there is no CHANGELOG entry. This does not touch CreatePdfThumbnail.java, which #56 fixes.

The same README fix for Go is in ConvertAPI/convertapi-library-go#21 and for .NET in ConvertAPI/convertapi-library-dotnet#83.

🤖 Generated with Claude Code

…ks pdf-to-split

The README "Additional conversion parameters" snippet passed scaleimage and
scaleproportions to pdf -> jpg. Neither is a pdf-to-jpg parameter, and the
API ignores them. The snippet now turns page 1 into a JPG that fits inside
300x300: pagerange, imagewidth, imageheight and fittosize.

The SplitAndMergePdf.java comment linked the pdf-to-extract page, although
the example uses split. It now links https://www.convertapi.com/pdf-to-split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the PDF conversion documentation corrections.

No open issues 🎉

What changed in this PR

This PR corrects the Java library’s conversion documentation without changing library behavior.

Changes:

  • Replaces unsupported PDF-to-JPG parameters in the README with parameters that convert page 1 to a JPG fitting within 300×300 pixels.
  • Corrects the split-and-merge example’s documentation link to point to the PDF split converter.
File Description
README.md Updates the PDF-to-JPG snippet with page selection and supported image-sizing parameters.
examples/​src/​main/​java/​com/​convertapi/​examples/​SplitAndMergePdf.java Corrects the PDF split URL in a comment; executable code is unchanged.

Review effort: Balanced

@tomasr78
tomasr78 merged commit f74854f into main Nov 9, 2026
5 checks passed
@tomasr78
tomasr78 deleted the fix-pdf-to-jpg-params branch November 9, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants